Skip to content

Limit interface scale #1502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 6, 2022
Merged

Limit interface scale #1502

merged 9 commits into from
Oct 6, 2022

Conversation

AlbyIanna
Copy link
Contributor

Motivation

The interface scaling of the IDE doesn't handle scaling properly:

  • as stated in Application allows setting interface scaling interface past limits #1384, it's possible to find yourself in unpredictable situations we're only limiting the scaling when using the stepper input
  • same thing happen with the editor font size
  • when changing the scaling really fast (e.g.: holding down CTRL/CMD + = for a while), the interface seems to 'bounce' from bigger to smaller and viceversa until it's stable

Change description

  • move the interface scaling logic to a separate contribution
  • the stepper in the settings dialog and the related commands now uses common values for min/max scale and font size
  • when the Automatic flag in the settings dialog is checked, enable/disable the 'Increase/Decrease Font Size' menu item and shortcuts when reaching -60% (min) and 280% (max)
  • when the Automatic flag in the settings dialog is unchecked, enable/disable the 'Increase/Decrease Font Size' menu item and shortcuts when reaching 8 (min) and 72 (max)

Other information

Since Theia doesn't support dynamic menu items, to achieve this I needed to dispose the menu items and re-register them, and then update the mainMenuManager manually, otherwise they wouldn't get updated as expected.

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

@kittaakos
Copy link
Contributor

Do you plan to get rid of the local settings field? Is this PR still in progress? See here: #1502 (comment).

@AlbyIanna
Copy link
Contributor Author

AlbyIanna commented Sep 29, 2022

Do you plan to get rid of the local settings field? Is this PR still in progress? See here: #1502 (comment).

@kittaakos I've already got rid of currentScale because it wasn't necessary (see last commit). About currentSettings – as stated in this comment → #1502 (comment) – I can't remove it because it's not only a duplicate but it also serves as temporary value in order to make the debouncing work correctly (see how I update the settings here)

Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I checked the code and left a few remarks.

Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have noticed some inconsistency between the disabled/enabled state of the menu item and the current editor.fontSize value.

Decrease expected to be disabled here:

Screen Shot 2022-10-04 at 09 07 56

Increase expected to be disabled here:

Screen Shot 2022-10-04 at 09 06 00

Decrease expected to be enabled here:

Screen Shot 2022-10-04 at 09 11 27

@per1234 per1234 linked an issue Oct 4, 2022 that may be closed by this pull request
3 tasks
@kittaakos kittaakos added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Oct 4, 2022
@AlbyIanna
Copy link
Contributor Author

I have noticed some inconsistency between the disabled/enabled state of the menu item and the current editor.fontSize value.

Thank you @kittaakos, I wasn't registering the menus properly after changing fontScalingEnabled. Fixed in this commit.

I also the menu items weren't updating when changing the autoScaleInterface setting, so I also fixed that in the last commit

@AlbyIanna AlbyIanna requested a review from kittaakos October 4, 2022 11:19
Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified it fixes #1384

Thanks Alberto!

Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's working great. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Application allows setting interface scaling interface past limits
3 participants